package com.bite.springtrans.demos.controller;

import com.bite.springtrans.demos.service.LogService;
import com.bite.springtrans.demos.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/pro")
public class ProController {
    @Autowired
    private LogService  logService;
    @Autowired
    private UserService userService;

    @Transactional
    @RequestMapping("/p1")
    public String r1(String userName,String password) {
        userService.registryUser(userName,password);
        logService.insertLog1(userName,"用户注册");
        return "方法实现成功";
    }
}
